const express = require('express');
const router = express.Router();
const data = [];
for(let i = 1; i < 51; i++)
    data.push({
        id: `${i}`,
        code: `BH2019082700-${i}`,
        transferOrderCode: 'SAPDB201909090001',
        deliveryCode: 'SAPJH201909090001',
        partOrderCode: 'XS201909090001',
        brandCode: 'QRIN',
        dealerCode: '10145',
        partOrderTypeName: '紧急订单',
        transportType: 1,
        pickingType: 1,
        itemCount: 10,
        pickingQuantityCount: 100,
        status: 1,
        createTime: '2019-09-04T02:37:44.918Z',
    });
router.get('/', (req, res) => {
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content: data,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});

router.get('/:id', (req, res) => {
    res.json({
        message: 'ok',
        payload: {
            id: '1',
            code: 'BH2019082700-1',
            transferOrderCode: 'SAPDB201909090001',
            deliveryCode: 'SAPJH201909090001',
            partOrderCode: 'XS201909090001',
            brandCode: 'QRIN',
            dealerCode: '10145',
            partOrderTypeName: '紧急订单',
            transportType: 1,
            pickingType: 1,
            itemCount: 10,
            pickingQuantityCount: 100,
            status: 1,
            createTime: '2019-09-04T02:37:44.918Z',
            dealerId: '1',
            dealerName: '总代001',
            currency: 1,
            pickedTotalAmountFee: 998.1,
            details: [
                {
                    partId: '1',
                    partCode: 'partCode1',
                    partName: 'partName1',
                    oldPartId: '2',
                    oldPartCode: 'partCode2',
                    oldPartName: 'partName2',
                    pickingQuantity: 3,
                    packedQuantity: 3,
                    price: 300,
                    pickedTotalAmount: 200,
                    packedTotalAmount: 200
                },
                {
                    partId: '2',
                    partCode: 'partCode2',
                    partName: 'partName2',
                    oldPartId: '1',
                    oldPartCode: 'partCode1',
                    oldPartName: 'partName1',
                    pickingQuantity: 3,
                    packedQuantity: 3,
                    price: 300,
                    pickedTotalAmount: 200,
                    packedTotalAmount: 200
                },
                {
                    partId: '3',
                    partCode: 'partCode3',
                    partName: 'partName3',
                    oldPartId: '4',
                    oldPartCode: 'partCode4',
                    oldPartName: 'partName4',
                    pickingQuantity: 3,
                    packedQuantity: 3,
                    price: 300,
                    pickedTotalAmount: 200,
                    packedTotalAmount: 200
                }
            ]
        }
    });
});
router.get('/export', (req, res) => {
    res.json({
        message: '导出成功',
        payload: 'Mock导出'
    });
});
router.put('/delivery', (req, res) => {
    res.json({
        message: '发货成功'
    });
});
router.put('/posting', (req, res) => {
    res.json({
        message: '发货过账'
    });
});
module.exports = router;
